package com.device_manager.controller;

import com.device_manager.dto.PageShipmentDTO;
import com.device_manager.dto.ShipmentDTO;
import com.device_manager.result.PageResult;
import com.device_manager.result.Result;
import com.device_manager.service.ShipmentService;
import com.device_manager.vo.PageShipmentListVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api")
@Slf4j
@Tag(name="发货单管理")
public class ShipmentController {
    @Autowired
    private ShipmentService shipmentService;
   @Operation(summary = "处理发货单")
   @PostMapping("/shipment")
   //处理发货单
    public Result<?> addShipment(  @RequestBody  ShipmentDTO shipmentDTO){

           return shipmentService.addShipment(shipmentDTO);
    }
    @Operation(summary = "查询发货单列表")
    @PostMapping("/shipmentList")
    public Result<PageResult<PageShipmentListVO>> shipmentList(PageShipmentDTO pageShipmentDTO){
       PageResult<PageShipmentListVO>  pageResult = shipmentService.shipmentList(pageShipmentDTO);
       return Result.success(pageResult);
    }
}
